<template>
	<view class="uni-popup-share-weixin">
		<view class="uni-share-title"><text class="uni-share-title-text">分享给好友</text></view>
		<view class="uni-share-content">
			<view class="uni-share-content-box">
				<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)">
					<view class="uni-share-image-box">
						<!-- <image class="uni-share-image" :src="item.icon" mode="aspectFill"></image> -->
						<uni-icons class="uni-share-image" color="rgba(255, 255, 255, 1)" :type="item.icon" size="32" />
					</view>
					<view class="uni-share-content-line" v-if="index == 0"></view>
				</view>

			</view>
		</view>
		<view class="uni-share-button-box">
			<button class="uni-share-button" @click="close">取消</button>
		</view>
	</view>
</template>

<script>
	import uniIcons from "../uni-icons/uni-icons.vue";
	export default {
		name: 'UniPopupShareWeixin',
		components: {
			uniIcons
		},
		props: {
			imgUrl: {
				type: String,
				default: '分享到'
			},
			diaryWord: {
				type: String,
				default: '分享到'
			},
			weinxinHref: {
				type: String,
				default: ''
			},
			shareTitle: {
				type: String,
				default: ''
			}
		},
		inject: ['popup'],
		data() {
			return {
				bottomData: [{
						text: '微信',
						icon: 'weixin',
						name: 'wx'
					},
					{
						text: '朋友圈',
						icon: 'pengyouquan',
						name: 'wxP'
					}
				]
			}
		},
		created() {},
		methods: {
			/**
			 * 选择内容
			 */
			select(item, index) {
				let scene = 'WXSenceTimeline'
				if (item == 'wx') {
					scene = 'WXSceneSession'
				}
				const _this = this
				uni.share({
					provider: "weixin",
					scene: scene,
					type: 0,
					href: _this.weinxinHref,
					title: _this.shareTitle,
					summary: _this.diaryWord,
					imageUrl: _this.imgUrl,
				});
				this.popup.close()
			},
			/**
			 * 关闭窗口
			 */
			close() {
				this.popup.close()
			}
		}
	}
</script>
<style lang="scss" scoped>
	.uni-popup-share-weixin {
		background: rgba(247, 247, 247, 1);
		border-radius: 12rpx 12rpx 0 0;
		width: 100%;
		.uni-share-content-item {
			width: 50%;
			/* #ifndef APP-NVUE */
			display: flex;
			/* #endif */
			justify-content: space-between;
			height: 143rpx;
			align-items: center;
		}
	}

	.uni-share-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		height: 118rpx;
		line-height: 118rpx;

	}

	.uni-share-title-text {
		font-size: 28rpx;
		color: #666;
	}



	.uni-share-content {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		padding: 10rpx 0 10rpx;
		align-items: center;
	}

	.uni-share-content-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		flex-wrap: wrap;
		width: 360px;
	}



	.uni-share-content-line {
		border-left: 1rpx solid rgba(102, 100, 93, 0.15);
		height: 88rpx;
		width: 10rpx;
	}

	.uni-share-image-box {
		flex: 1;
		text-align: center;
		height: 103rpx;
	}

	.uni-share-content-item:active {
		background-color: #f5f5f5;
	}

	.uni-share-image {
		background: rgba(9, 193, 104, 1);
		border-radius: 50%;
		height: 88rpx;
		line-height: 88rpx;
		display: block;
		width: 88rpx;
		text-align: center;
		margin: 0 auto;

	}

	.uni-share-text {
		margin-top: 10px;
		font-size: 14px;
		color: #3B4144;
	}

	.uni-share-button-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
	}

	.uni-share-button {
		flex: 1;
		color: #666;
		font-size: 16px;
		background: #fff;
	}

	.uni-share-button::after {
		border: none;
	}
</style>
